/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Serialize;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.util.Vector;
import mySwing.icaoB;
import mySwing.myBar;

/**
 *
 * @author dimitris
 */
public class myIO {

    public static void write(myBar f, String filename) throws Exception {
        FileOutputStream fos = new FileOutputStream(filename);
        ObjectOutputStream oos = new ObjectOutputStream(fos);

        oos.writeObject(f.getVectorForSave());

        oos.close();
        fos.close();
    }

    public static Vector<icaoB> read(String filename) throws Exception {
        FileInputStream fos = new FileInputStream(filename);
        ObjectInputStream oos = new ObjectInputStream(fos);

        Vector <icaoB> result = (Vector) oos.readObject();

        oos.close();
        fos.close();

        return result;
    }
}
